﻿<UserControl x:Class="Friends.Page"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"  
  xmlns:MyOpenSpace="clr-namespace:MyOpenSpace;assembly=MySpaceSilverlightKit"             
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <MyOpenSpace:MySpacePeopleRequest x:Key="OwnerFriends" 
            IdSpec="opensocial.IdSpec.PersonId.OWNER" Max="1000" PageSize="100" />
        <DataTemplate x:Key="FriendTemplate">
            <Border Background="Silver" CornerRadius="4">
                <StackPanel Margin="2">
                    <Grid Height="100" Width="100">
                        <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Bottom"  Text="" FontFamily="Webdings" FontSize="72" TextAlignment="Center" Margin="2"/>
                        <Image Margin="2" Source="{Binding ThumbnailImage}" />
                    </Grid>
                    <HyperlinkButton Foreground="Black" Margin="2" 
                        Content="{Binding DisplayName}" 
                        NavigateUri="{Binding ProfileUrl}"/>
                </StackPanel>
            </Border>
        </DataTemplate>
        <ItemsPanelTemplate x:Key="FriendsPanel">
            <controls:WrapPanel/>
        </ItemsPanelTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox 
            ItemTemplate="{StaticResource FriendTemplate}" 
            ItemsPanel="{StaticResource FriendsPanel}"
            ItemsSource="{Binding People, Source={StaticResource OwnerFriends} }"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
    </Grid>
</UserControl>
